<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Insert title here</title>
	<link rel="stylesheet" href="__PUBLIC__/js/bootstrapvalidator/css/bootstrapValidator.min.css" />
	<link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload.css" />
	<link rel="stylesheet" href="__PUBLIC__/js/jquery-upload/css/jquery.fileupload-ui.css" />
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/vendor/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.iframe-transport.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery-upload/js/jquery.fileupload-process.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
</head>
<body>
<div class="modal-dialog" role="document" style="width:800px;">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			<h4 class="modal-title" id="exampleModalLabel">通知详情</h4>
		</div>
		<form class="form-horizontal" style="padding:4%;height:500px;overflow-y:auto;" id="noticeForm">
			<div class="form-group">
				<label class="control-label col-sm-2">标题:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" name="title" value="{$notice.title}">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-sm-2">内容:</label>
				<div class="col-sm-10">
					<script id="container" name="content" type="text/plain">{$notice.content}</script>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-sm-2">是否有效:</label>
				<div class="col-sm-10">
					<input type="checkbox" name="status" value="{$notice.status|default="1"}" />
				</div>
			</div>
		</form>
		<div class="modal-footer">
			<button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
		</div>
	</div>
</div>

<script type="text/javascript">
    var webRoot = "__ROOT__";
    var uEditor;
	$(function(){
        if(typeof uEditor != "undefined") {
            uEditor.destroy();
        }
        uEditor = UE.getEditor('container');
        uEditor.ready(function() {
            uEditor.setHeight(200);
		});
        initSwitchOption("status","有效","无效","{$notice.status}");
    });

    function initSwitchOption(name,onText,offText,state) {
        var switchOption = {
            onText: onText,
            offText: offText,
            onColor: "success",
            offColor: "info",
            state: state == 1 ? true : false,
            onSwitchChange: function (event, state) {
                if (state == true) {
                    $(this).val("1");
                } else {
                    console.log(state);
                    $(this).val("0");
                }
            }
        };
        $("input:checkbox[name='"+name+"']").bootstrapSwitch(switchOption);
    }

</script>
</body>
</html>